const env = process.env.NODE_ENV;
import axios from "axios";
import Setting from "../../../setting";

// 文件上传  chenxin 修改
// 上传签名文件
export function signUpload(data){
  var pre = env === "development" ? "/fileApi" : (Setting.fileUrlPre + sessionStorage.getItem("UAP_ISC_PORT"));
  let token = sessionStorage.getItem("token") || "";
  return new Promise((resolve,reject)=>{
    axios.post(`${pre}/file/upload`,
        data,
        {
          headers:{
            'Content-Type': 'multipart/form-data; boundary = ' + new Date().getTime(),
            'token':token
            //这里要把content-type设置为multipard/form-data，同时还要设置boundary
          }
        }).then(result=>{
      resolve(result.data)
    }).catch(err=>{
      reject(err)
    })
  })
}

